﻿using Efcore.MultiTenant.Entity;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Efcore.MultiTenant
{
    public static class MultiTenantBuilderExtensions
    {
        /// <summary>
        /// 自定义实体扫描器
        /// </summary>
        /// <param name="multiTenantBuilder"></param>
        public static MultiTenantBuilder ReplaceEntityScanner<TEntityScanner>(this MultiTenantBuilder multiTenantBuilder) where TEntityScanner : class, IEntityScanner
        {
            multiTenantBuilder.ServiceCollection.Replace(ServiceDescriptor.Singleton<IEntityScanner, TEntityScanner>());
            return multiTenantBuilder;
        }
    }
}
